/* Copyright IBM Corp. 2014
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
packagecom.ibm.xsp.insights.beans;
public class BaseBean {
private static final long serialVersionUID = 1L;
protected static final String PLING = "!!";
protected static final String SLASH = "\\";
protected static final String AT_SYMBOL = "@";
protected static final String MINUS_SYMBOL = "-";
protected static final String PLUS_SYMBOL = "+";
protected static final String EQUALS_SYMBOL = "=";
protected static final String SPLIT_STRING = ",";
protectedboolean debug = false;
protected String serverName;
publicBaseBean() {
}
public String getServerName() {
returnserverName;
}
public void setServerName(String serverName) {
if (serverName.startsWith(SLASH)) {
serverName = serverName.substring(SLASH.length());
}
this.serverName = serverName;
}
publicbooleanisDebug() {
return debug;
}
public void setDebug(boolean debug) {
this.debug = debug;
}
public void setDebug(String debug) {
this.debug = Boolean.parseBoolean(debug);
}
} // end BaseBean
/* Copyright IBM Corp. 2014
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
packagecom.ibm.xsp.insights.interfaces;
public final class INSFContants {
public static final String VIEW_PROFILES = "profiles";
public static final String DEMO_OA_NAME = "Finance Workflow";
public static final String FILED_NSFLIST = "nsflist";
//finance workflow
public static final String VIEW_ALLREQUESTS = "requests";
public static final String VIEW_PROJECTVIEW = "projectsView";
}
/* Copyright IBM Corp. 2014
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
packagecom.ibm.xsp.insights.beans;
importjava.util.ArrayList;
importjava.util.List;
importlotus.domino.Database;
importlotus.domino.NotesException;
importlotus.domino.Session;
importlotus.domino.View;
public class DataBean extends BaseBean {
private static final long serialVersionUID = 1L;
protected List<String> databases = new ArrayList<String>();
protected String userName;
publicDataBean() {
}
public List<String>getDatabasesConfiguration() {
return databases;
}
public void setDatabasesConfiguration(List<String>dbs){
this.databases = dbs;
}
// ------------------------------------------------------------------------
public String getUserName() {
returnuserName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public View getView(final String viewName, Database database) {
try {
if (null == viewName || viewName.length() == 0) {
throw new Exception("No viewName supplied");
}
if (null == database) {
throw new Exception("No database supplied");
}
returndatabase.getView(viewName);
} catch (NotesException e) {
e.printStackTrace();
} catch (Exception e2) {
e2.printStackTrace();
}
return null;
}
public View getView(final String viewName, String dbName, Session session) {
try {
if (null == viewName || viewName.length() == 0) {
throw new Exception("No viewName supplied");
}
if (null == dbName || dbName.length() == 0) {
throw new Exception("No dbName supplied");
}
if (null != session) {
Database db = session.getDatabase(serverName, dbName);
if (null != db) { // &&db.isOpen()){
returndb.getView(viewName);
}
}
return null;
} catch (NotesException e) {
e.printStackTrace();
} catch (Exception e2) {
e2.printStackTrace();
}
return null;
}
// Utility method
public Database getDatabase(String dbName, Session session) {
try {
if (null != dbName) {
// Session session = ExtLibUtil.getCurrentSession();
if (null != session) {
Database db = session.getDatabase(serverName, dbName);
if (!db.isOpen())
db.open();
if (null != db&&db.isOpen()) {
returndb;
}
}
}
return null;
} catch (NotesException e) {
e.printStackTrace();
}
return null;
}
publicbooleanisDatabaseFTIndexed(String dbName, Session session) {
try {
if (null != dbName) {
Database db = getDatabase(dbName, session);
if (null != db) {
returndb.isFTIndexed();
}
}
return false;
} catch (NotesException e) {
e.printStackTrace();
}
return false;
}
} // end dataBean
/* Copyright IBM Corp. 2014
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
packagecom.ibm.xsp.insights.beans;
importjava.io.Serializable;
importjava.util.Vector;
importlotus.domino.Database;
importlotus.domino.Document;
importlotus.domino.NotesException;
importlotus.domino.Session;
importlotus.domino.View;
importcom.ibm.xsp.insights.interfaces.INSFContants;
public class DatabaseBean extends DataBean implements Serializable{
private static final long serialVersionUID = 1L;
public void init(Session s) throws NotesException {
databases.clear();
Database db = s.getCurrentDatabase();
View view = db.getView(INSFContants.VIEW_PROFILES);
Document doc = view.getDocumentByKey(INSFContants.DEMO_OA_NAME);
Vector vec = doc.getItemValue(INSFContants.FILED_NSFLIST);
databases.addAll(vec);